/*
 * Copyright (C) 2016  Nicola Spanti (RyDroid) <dev@nicola-spanti.info>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */


#ifndef PLANET_WARS_2D_RT_SDL2_GAME_PLAYING_DATA_H
#define PLANET_WARS_2D_RT_SDL2_GAME_PLAYING_DATA_H


#include "PlanetWars2dRT-core/utils/c_language.h"
#include "PlanetWars2dRT-core/utils/bool.h"
#include <SDL2/SDL_render.h>


EXTERN_C_BEGIN


struct game_playing_data_sdl
{
  SDL_Renderer*  main_window_renderer;
  SDL_Window*    main_window;
  
  unsigned short time_ms_per_frame;
  unsigned int   time_ms_last_frame;
  float          frame_per_second;
};

typedef struct game_playing_data_sdl game_playing_data_sdl;


bool
game_playing_data_sdl_init_first_time_only(game_playing_data_sdl* data);

struct game_playing_data_sdl
game_playing_data_sdl_create(void);


unsigned short
game_playing_data_sdl_get_max_time_ms_per_frame(const game_playing_data_sdl* data);

float
game_playing_data_sdl_get_frame_per_second_max(const game_playing_data_sdl* data);

float
game_playing_data_sdl_get_frame_per_second_current(const game_playing_data_sdl* data);

bool
game_playing_data_sdl_set_max_time_ms_per_frame(game_playing_data_sdl* data,
						unsigned short value);

bool
game_playing_data_sdl_set_frame_per_second_max(game_playing_data_sdl* data,
					       float value);


EXTERN_C_END


#endif
